TclX
Section: Misc. Reference Manual Pages (TCL)
Updated:
Index
Return to Main Contents
NAME
TclX - Extended Tcl - Extended command set for Tcl 6.1.
INTRODUCTION
This man page contains the documentation for all of the extensions that are
added to Tcl 6.1 by Extended Tcl. These extensions provide their
capabilities by adding new commands to Tcl whitout changing the syntax of
standard Tcl. Extended Tcl is a superset of standard Tcl and is built with
the standard Tcl sources.
- The command descriptions are separated into several sections:
-
- o General Commands
-
- o Unix Access Commands
-
- o File I/O Commands
-
- o File Scanning Commands
-
- o Math Commands
-
- o List Manipulation Commands
-
- o Keyed Lists
-
- o String and Character Manipulation Commands
-
GENERAL COMMANDS
A set of general useful Tcl commands. Includes interactive inputting of
commands, a facility for tracing execution and a looping command.
- commandloop [prompt] [prompt2]
-
Create an interactive command loop for the current TCL interpreter. This
command receives commands from stdin and executes them. This command is
useful for non-interactive TCL scripts that want to enter an interactive mode.
Prompt is a command string to set the top level prompt hook to
to, the contents of which is executed to generate the main prompt.
Prompt2 is a command string to set the down level prompt to, which is
generates the prompt command for continuation input. When the command
terminates, the variables for the prompt hooks will be set to their old value.
If these arguments are not specified, the prompt hooks use their current
value. Prompt hooks are TCL code that return as their result the prompt to
output. The result of the last command executed in the command string (which
may be a return) will be outputted as the prompt.
- cmdtrace level|on [noeval] [notruncate] [flush] [filehandle]
-
Print a trace statement for all commands executed at depth of level or
below (1 is the top level). If on is specified, all commands at any
level are traced.
If noeval is specified, arguments are
printed unevaluated -- if it is not specified, the arguments are printed after
evaluation. If the command line is longer than 60 characters, it is truncated
to 60 and a "..." is postpended to indicate that there was more. If
noeval wasn't specified, the arguments are printed after evaluation. In
this case, each argument is truncated to 40 characters (with "..." postpended
if the argument was longer than 40 characters) and printed. If an evaluated
argument contains a space, the entire argument will be enclosed inside of
braces (`{}') to allow the reader to visually separate the arguments from
each other. If notruncate is specified, then the truncation of commands
and evaluated arguments will be disabled. If flush is specified, then
the output buffer will be flushed after each line is printed. This is useful
when tracing code that cause an application to abort, making it easy to narrow
the problem down to the command that caused the abort. If filehandle is
specified, then the trace output will be written to the file.
- cmdtrace off
-
Turn off all tracing.
- cmdtrace depth
-
Returns the current maximum trace level, or zero if trace is disabled.
- echo str1 [str2..]
-
Print the strings to stdout followed by a newline.
- infox option
-
Return information about extended Tcl or the current application.
The following infox command options are available.
-
- version
-
Return the version number of Extended Tcl. The version number for
extended Tcl is generated by combining the base version of the standard Tcl
code with a letter indicating the version of Extended Tcl being used. This is
the documentation for version tcl6.1a.
- patchlevel
-
Return the patchlevel for Extended Tcl.
- appname
-
Return the symbolic application name of the current application linked with
the Extended Tcl library. The C variable tclAppName must be set by the
application to return an application specific value for this variable.
- applongname
-
Return a natural language name for the current application. The C variable
tclLongAppName must be set by the application to return an application
specific value for this variable.
- appversion
-
Return the version number for the current application. The C variable
tclAppVersion must be set by the application to return an application
specific value for this variable.
- loop var first last [increment] body
-
Loop is a looping command, similar in behavior to the Tcl for
statement, except that the loop statement achieves substantially higher
performance and is easier to code when the beginning and ending values of a
loop are known and the loop variable is to be incremented by a known, fixed
amount every time through.
The var argument is the name of a Tcl variable that will contain the
loop index. The loop index is first set to the value specified by
first. The Tcl interpreter is invoked upon body zero or more
times, where var is incremented by increment every time through
the loop, or by one if increment is not specified. Increment can
be negative in which case the loop will count downwards.
When var reaches last, the loop terminates without a subsequent
execution of body. For instance, if the original loop parameters
would cause loop to terminate, say first was one, last was
zero and increment was not specified or was non-negative, body is
not executed at all and loop returns.
If a continue command is invoked within body then
any remaining commands in the current execution of body are skipped,
as in the for command.
If a break command is invoked
within body
then the loop command will
return immediately.
Loop returns an empty string.
UNIX ACCESS COMMANDS
These commands provide access to many basic Unix facilities, including process
handling, data and time, signal handling, linking and unlinking files,
changing file attributes, process and user attributes and the executing
commands via the shell.
- alarm seconds
-
Instructs the system to send a SIGALRM signal in the specified number of
seconds. If seconds is 0, any previous alarm request is canceled.
Only one alarm at a time may be active, the command returns the number of
seconds left in the previous alarm.
- chgrp group filelist
-
Set group of each file in the list filelist to group, which is a
group name or numeric group id.
- chmod [-i] mode filelist
-
Set permissions of each of the files in the list filelist to mode,
which is an absolute numeric mode or symbolic permissions as in the
chmod(C) UNIX command. Normally absolute modes are assumed to be
specified in octal. However Tcl stores numbers internally as integers. The
-i option causes an absolute mode to be treated as a standard Tcl
integer (decimal unless prefixed by "0" of "0x").
- chown owner|{owner group} filelist
-
Set owner of each file in the list filelist to owner, which is a
owner name or numeric owner id. If the first parameter is a list, then the
owner is set to the first element of the list and the group is set to the
second element of the list. Group is a group name or numeric group id.
If group is {}, then the file group will be set to the group for the
associated the specified user.
- execvp prog [arg1...argN]
-
Do an execvp, replacing the current program with prog and passing the
arguments arg1...argN.
- fmtclock clockval [format] [GMT|{}]
-
Convert a value returned by getclock or file to human readable
form. The format argument is a string that describes how to format the
date and time. Field descriptors consist of a ``%'' followed by a field
descriptor. All other characters are copied into the result. The available
field descriptors are:
%% - Insert a %.
%a - Abbreviated weekday name.
%A - Full weekday name
%b - Abbreviated month name.
%B - Full month name.
%d - Day of month (01 - 31).
%D - Date as %m/%d/%y.
%e - Day of month (1-31), no leading zeros.
%h - Abbreviated month name.
%H - Hour (00 - 23).
%I - Hour (00 - 12).
%j - Day number of year (001 - 366).
%m - Month number (01 - 12).
%M - Minute (00 - 59).
%n - Insert a new line.
%p - AM or PM.
%r - Time as %I:%M:%S %p.
%R - Time as %H:%M.
%S - Seconds (00 - 59).
%t - Insert a tab.
%T - Time as %H:%M:%S.
%U - Week number of year (01 - 52), Sunday is the first
day of the week.
%w - Weekday number (Sunday = 0).
%W - Week number of year (01 - 52), Monday is the first
day of the week.
%x - Local specific date format.
%X - Local specific time format.
%y - Year within century (00 - 99).
%Y - Year as ccyy (e.g. 1990)
%Z - Time zone name.
If format is not specified, "%a %b %d %H:%M:%S %Z %Y" is used. If GMT
is specified, the time will be formated as Greenwich Mean Time. If the
argument is not specified or is empty, then the local timezone will be used as
defined by the timezone environment variable.
- fork
-
Fork the current TCL process. Fork returns zero to the child process and the
process number of the child to the parent process. If an execvp is not
going to be performed before the forked process does output, then a
flush should be issued against stdout, stderr and any other
open output file before doing the fork. Otherwise, output from the
parent process pending in the buffers will also be outputted by the child
process.
- getclock
-
Return the current date and time as a system dependent integer value. The
unit of the value is seconds, allowing it to be used for relative time
calculations and so forth.
- id options
-
This command provides a means of getting, setting and converting user, group
and process ids. The following versions of the id command are available:
-
- id user [name]
-
- id userid [uid]
-
Set the real and effective user ID to name or uid, if the
name (or uid) is valid and permissions allow it. If the name (or uid)
is not specified, the current name (or uid) is returned.
- id convert userid uid
-
- id convert user name
-
Convert a user ID number to a user name, or vice versa.
- id group [name]
-
- id groupid [gid]
-
Set the real and effective group ID to name or gid, if the
name (or gid) is valid and permissions allow it. If the group name
(or gid) is not specified, the current group name (or gid) is returned.
- id convert groupid gid
-
- id convert group name
-
Convert a group ID number to a group name, or vice versa.
- id effective user
-
- id effective userid
-
Return the effective user name, or effective user ID number, respectively.
- id effective group
-
- id effective groupid
-
Return the effective group name, or effective group ID number, respectively.
- id process
-
Return the process ID of the current process.
- id process parent
-
Return the process ID of the parent of the current process.
- id process group
-
Return the process group ID of the current process.
- id process group set
-
Set the process group ID of the current process to its process ID.
- kill [signal] processlist
-
Send a signal to the each process in the list processlist, if permitted.
Signal, if present, is the signal number or the symbolic name of the
signal, see the signal system call manual page. The leading "SIG" is optional
when the signal is specified by its symbolic name.
The default for signo is 15, SIGTERM.
- link srcpath destpath
-
Create a directory entry, destpath, linking it to the existing file,
srcpath.
- mkdir [-path] dirList
-
Create each of the directories in the list dirList. The mode on the
new directories is 777, modified by the umask. If -path is specified,
then any non-existent parent directories in the specified path are also
created.
- rmdir dirList
-
Remove each of the directories in the list dirList.
- signal action siglist [command]
-
Specify the action to take when a Unix signal occurs. Siglist is a list
of either the symbolic or numeric Unix signal (the SIG prefix is optional).
Action is one of the following actions to be performed on receipt of the
signal.
-
default - Terminate the process
-
ignore - Ignore the signal.
-
error - Generate a catchable Tcl error. It will be as if the command
that was running returned an error. The error code will be in the form:
{UNIX SIG signame}
For the death of child signal, signame will always be SIGCHLD, rather
than SIGCLD, to allow writting protable code.
-
trap - When the signal occures, execute command and continue
execution if an error is not returned by command. If will be executed
in the global context and the symbolic signal name (e.g. SIGINT) will be
supplied in a global variable signalRecieved. If an error is returned,
then follow the standard Tcl error mechanism. Often command will just
do an exit.
-
get - Retrieve the current settings of the specified signals. A list
will be returned with each element containing one of `default',
`ignore', `error' or `trap' corresponding to each signal in
siglist.
For all signals except SIGCLD, the signal action will remain enabled
after the specified signal has occured. For SIGCLD (also known as
SIGCHLD), the signal will not be automatically reenable. A wait must be
performed before issuing another signal command. Signals are not
processed until after the completion of the Tcl command that is executing when
the signal is recieved.
- sleep seconds
-
Sleep the TCL process for seconds.
- system command
-
Executes command via the system(3) call. Differs from exec
because system doesn't return stdout as the result or the command and
system goes through the shell to provide wildcard
expansion, redirection, etc,
as is normal from a sh command line. Returns the exit code of
the command.
- times
-
Return a list containing the process and child execution times in the form:
utime stime cutime cstime
See times system call manual page. The values are in milliseconds.
- umask [octalmask]
-
Sets file-creation mode mask to the octal value of octalmask.
If octalmask is omitted, the current mask is returned.
- unlink filelist
-
Delete (unlink) the files whose names are in the list filelist.
- wait proclist
-
Waits for an any of the immediate child processes specified in the list
proclist to terminate or a signal to be received. Wait returns a
list of three elements: The first element is process id of the terminating
process. If the process exited normally, the second element is `EXIT',
followed by the error code. If the process terminated because of a signal,
the second element is `SIG', followed by the signal name. If the process is
currently stopped, the second element is `STOP', followed by the signal name.
FILE I/O COMMANDS
The commands extend the stdio-style file I/O capabilities present in Tcl 6.1.
These extensions include searching ASCII-sorted data files, copying files,
duplicating file descriptors, control of file access options, retrieving open
file status, and creating pipes with the pipe system call. A interface
to the select system call is also available on Unix systems that support
it.
It should be noted that Tcl file I/O is implemented on top of the stdio
library. By default, the file is buffered, when communicating to a process
through a pipe, a flush command should be issued to force the data
out. Alternatively, the fcntl command may be used to set the buffering
mode to line buffered or unbuffered.
- bsearch filehandle key [retvar] [compare_proc]
-
Search an opened sorted data file, filehandle, for a line
matching key. If retvar is specified, then the line from the
file is returned in retvar and the command returns 1 if key
was found, and 0 if it was not found. If retvar is not specified
or is a null name, then the command returns the line that was found, or an
empty string if key is not found.
By default, the key is matched against the first white-space seperated field
in each line. The field is treated as an ASCII string. If compare_proc
is specified, then it is the name of a Tcl procedure to evaluate against each
line read from the file. This compare_proc takes two arguments, the key
and a line extracted from the file. The compare routine should return a
number less than zero if the key is less than the line, zero if the key
matches the line or greater than zero if the key is greater than the line.
The file must be sorted in assending order by whatever criteria
compare_proc uses to compare the key with the line.
- copyfile handle1 handle2
-
Copies the rest of file specified by handle1 from its current position
to the file specified by handle2.
- dup filehandle [stdhandle]
-
Duplicate an open file. A file handle is created that addresses the
same file as filehandle.
A special case is allowed for dup-ing files to stdin, stdout or stderr.
If stdhandle is specified, then it must be one of the
standard handles to dup filehandle to.
proc ChildProcess {cmd inPipe outPipe} {
if {[set childPid [fork]] == 0} {
close stdin
dup $inPipe stdin
close $inPipe
close stdout
dup $outPipe stdout
close $outPipe
execvp $cmd
# will never make it here...
}
return $childPid
}
- fcntl handle [attribute value]
-
This command either returns a list of various boolean attributes controlling
access to a file or set or clears one of the boolean attributes. If
attribute and value are not specified, then the list of the
attributes that are set are return. If an attribute is not set, then it will
not be included in the list. The following attributes maybe returned:
-
RDONLY - The file is opened for reading only.
WRONLY - The file is opened for writing only.
RDWR - The file is opened for reading and writing.
APPEND - The file is opened for append only writes. All writes will
be forced to the end of the file.
NDELAY - The file is to be accessed with non-blocking I/O. See the
read system call for a description of how it affects the behaviour of
file reads
CLEXEC - Close the file on an process exec. If the execvp
command or some other mechanism causes the process to exec, the file will
be closed.
NOBUF - The file is not buffered. If set, then there no stdio buffering
for the file.
LINEBUF - Output the file will be line buffered. The buffer will
be flushed when a newline is written, when the buffer is full,
or when input is requested.
The APPEND, NDELAY, and CLEXEC attributes may be set or
cleared by specifying the attribute name and a value 1 to set the
attribute and 0 to clear it.
The NOBUF and LINEBUF attributes may only be set (a value of
1) and only one of the options may be set. Once set, they may not be
cleared. Thees option should be set before any I/O operations have been done
on the file.
- fstat handle [arrayvar]
-
Obtain the status of an open file. This differs from the file stat
command in that it takes a file handle rather than a file name.
If arrayvar is
specified, the status information is returned in the following elements of
this array variable: atime, ctime, dev, gid,
ino, mode, mtime, nlink, size, uid.
Each element is a decimal string with the value of the corresponding
field from the stat return structure; see the manual entry
for stat for details on the meanings of the values. If arrayvar
is not specified, then the information is returned as a keyed list. Each
element of the list is itself a list with the status value name paired with its
value, in alphabetical order. For example:
-
{atime 683617279} {ctime 683617310} {dev 298} {gid 50} {ino 6317}
{mode 33152} {mtime 683617310} {nlink 1} {size 924} {uid 200}
- pipe [handle_var_r handle_var_w]
-
Create a pipe (see the pipe system call manual page). If handle_var_r
and handle_var_r are specified, then variable handle_var_r will
contain the handle opened for reading and handle_var_w will contain the
handle opened for writing. If the handle variables are not specified, then a
list containing the read followed by the write handle is returned as the
result of the command.
- select readhandles [writehandles] [excepthandles] [timeout]
-
This command allows polling or blocking on multiple files being ready for
for reading, are ready for writing, or have an exceptional condition pending.
readhandles, writehandles, excepthandles are each lists
of file handles (as returned from open) to query. An empty list ({}) may
be specified if a category is not used.
The readhandles files are checked to set if data is available for
reading. The writehandles are checked if they are clear for writing The
excepthandles are checked to see if an exceptional condition has
occured. The write and exception checking is most useful on devices, however,
the read checking is also very valuable when communicating with multiple
processes through pipes.
Timeout is a floating point timeout number of seconds. If an empty
list is supplied (or the parameter is omitted), then no timeout is set. If
the value is zero, then the select command functions as a poll of the
files.
If the timeout period expires with none of the files becomming ready,
then the command returns an empty list. Otherwise the command returns a
list of three elements, each of those elements is a list of the file handles
that are ready in the read, write and exception classes. If none are ready in
a class, then that element will be the null list. For example:
select {file3 file4 file5} {file6 file7} {} 10.5
could return
{file3 file4} {file6} {}
or perhaps
file3 {} {}
FILE SCANNING COMMANDS
These commands provide a facility to scan files, matching lines of the file
against regular expressions and executing Tcl code on a match. With this
facility you can use Tcl to do the sort of file processing
that are traditionally done with awk. And since Tcl's approach is more
declarative, some of the scripts that are really hard to write in awk are a
snap in Tcl.
File scanning in Tcl centers around the concept of a scan context.
A scan context contains one or more match statements, which associate
regular expressions to scan for with Tcl code to be executed when the
expressions are matched.
- scancontext [option]
-
This command manages file scan contexts. A scan context is a collection of
regular expressions and commands to execute when that regular expression
matches a line of the file. A context may also have a single default match,
to be applied against lines that do not match any of the regular expressions.
Multiple scan contexts may be defined and the may be reused on multiple files.
A scan context is identified by a context handle. The scancontext
command takes
the following forms:
- scancontext create
-
Create a new scan context. The scanmatch command is used to define
patterns in the context.
- scancontext delete contexthandle
-
Delete the scan context identified by contexthandle and free all the
match statements and compiled regular expressions associated with the
specified context.
- scanfile contexthandle filehandle
-
Scan the file specified by filehandle, starting at the
current file position. Check all patterns in the scan context specified by
contexthandle against
it, executing the match commands corresponding to patterns matched.
- scanmatch [-nocase] contexthandle [regexp] commands
-
Specify Tcl commands, to be evaluated when regexp is matched by a
scanfile command. The match is added to the scan context specified by
contexthandle. Several match statements may be
specified for a give context. Regexp is a regular expression (see the
regexp command). If -nocase is specified as the first argument,
the pattern is matched regardless of
alphabetic case.
If regexp is not specified, then a default match is
specified for the scan context. The default match will be executed when a
line of the file does not match any of the specified regular expressions.
The array, matchInfo, is available when the Tcl code is executed and
contains information about the file being scanned. It is local to the top
level of the match command unless declared global at that level. If it is to
be used as a global it must be declared global before scanfile is
called (since scanfile sets the matchInfo before the match code is
executed, a subsequent global will override the local variable). The
text of the file line that was matched is in matchInfo(line). The byte
offset into the file of the line that was matched is in
matchInfo(offset). The line number of the line that was matched is in
matchInfo(linenum). This is relative to the first line scanned, not the
first line of the file. The first line is line number one. The file handle
of the file being scanned is in matchInfo(handle).
All scanmatch patterns that match a line will be processed in the order
that the specifications were added to the scan context. The remainder of the
scanmatch pattern-command pairs may be skipped for a file line if a
continue is executed in the match command. If a return is
executed in the body of the match command, the scanfile command in
progress returns with the value passed to return as it's value.
MATH COMMANDS
These commands make many additonal math functions available in Tcl, including
min, max, trig functions, exponent, logarithm, square root, and more. An
integer random number generator is provided as well.
- acos num
-
Returns the arccosine of num. num is in radians.
- asin num
-
Returns the arcsin of num. num is in radians.
- atan num
-
Returns the arctangent of num. num is in radians.
- ceil num
-
Returns the smallest integer not less than num (floating point).
- cos num
-
Returns the cosine of num. num is in radians.
- cosh num
-
Returns the hyperbolic cosine of num.
- exp num
-
Returns e to the power of num.
- fabs num
-
Returns the absolute value of num (floating point).
- floor num
-
Returns the largest integer not greater than num (floating point).
- fmod num1 num2
-
Returns num1 modulo num2.
- max num1 num2 [..numN]
-
Returns the argument that has the highest numeric value. The arguments,
numN may be any interger or floating point values.
- min num1 num2 [..numN]
-
Returns the argument that has the lowest numeric value. The arguments,
numN may be any interger or floating point values.
- log num
-
Returns the natural logarithm of num.
- log10 num
-
Returns the logarithm base 10 of num.
- pow num1 num2
-
Returns num1 to the power of num2.
- random limit | seed [seedval]
-
Generate a pseudorandom integer number greater than or equal to zero and
less than limit. If seed is specified, then the command
resets the random number generator to a starting point derived from
the seedval. This allows one to reproduce a random number sequence
for testing purposes.
If seedval is omitted, then the seed is set to a value based on current
system state and the current time, providing a reasonably interesting and
ever-changing seed.
- sin num
-
Returns the sin of num. num is in radians.
- tan num
-
Returns the tangent of num. num is in radians.
- sinh num
-
Returns the hyperbolic sin of num.
- sqrt num
-
Returns the square root of num.
- tanh num
-
Returns the hyperbolic tangent of num.
LIST MANINIPULATION COMMANDS
Extended Tcl provides two additional list manipulation commands.
- lempty list
-
Determine if the specified list is empty.
If empty, 1 is returned, otherwise, 0 is returned. This command is an
alternative to comparing a list to an empty string.
- lvarpop var [index [string]]
-
The lvarpop command pops (deletes) the element indexed by
index from the list in the variable var.
If index is omitted, then 0 is assumed.
If string, is specified, then the deleted element is replaced by
string. The replaced or deleted element is returned.
Thus ``lvarpop argv 0'' returns the first element and sets argv to contain the
remainder of the string.
KEYED LISTS
Extended Tcl defines a special type of list referred to as keyed lists.
These lists provided a structured data type built upon standard Tcl lists.
This provides a functionality similar to structs in the C
programming language.
A keyed list is a list in which each element is a key and value pair field.
These elements are actually lists themselves, were the key is the first
element of the list, and the value is the second. The key-value pairs are
refered to as fields.
This is an example of a keyed list:
-
{{NAME {Frank Zappa}} {JOB {musician and composer}}
By convention, `.' is a field name separator, allowing nesting of fields,
even though keyed list are only one level deep. Currently none of the commands
explictly function on nested field names, but they may in a future release,
so `.' should not be used for other than a field separator in a name. For
example:
-
{{ID 106} {NAME.FIRST Frank} {NAME.LAST Zappa}}
All key list functions take the name of the variable containing the keyed list
as an argument (i.e. passed by reference) rather than the value.
- keyldel listvar key
-
Delete the field specified by key from the keyed list in the
variable listvar. This removes both the key and the value from
the keyed list.
- keylget listvar key [retvar | {}]
-
Return the value associated with the key out of keyed list in the
variable listvar. If retvar is not specified, then the value will
be returned as the result of the command. If key is not found in the
list, an error will result. If retvar is specified and key is in
the list, then the value is returned in the variable retvar and the
command returns one.
If key is not in the list, the command will return 0
and retvar will be unchanged. If {} is specified for
retvar, the value is not returned, only the presence of the key is
determined.
- keylset listvar key value
-
Set the value associated with the key in the keyed list in the
variable listvar to value.
If listvar does not exists, it is created. If key
is not currently in the list, it will be added. If it already exists,
value overrides the existing value.
STRING AND CHARACTER MANIPULATION COMMANDS
The commands provide additional functionality to classify characters, convert
characters between character and numeric values, and index into a string,
determine the length of a string, extract a range of character from a string,
replicate a string a number of times, and transliterate a string (similar to
the tr command).
- cindex string index
-
Returns the character indexed by index (zero based) from string.
This command is a shortcut for:
string index string index
- clength string
-
Returns the length of string in characters.
This command is a shortcut for:
string length string
- crange string first last
-
Returns a range of characters from string starting at first
(zero-based) until last. The special keyword end may be specified
for last to indicate that the remainder of the string is to be
extracted. This command is a short cut for:
string range string first last
- csubstr string first length
-
Returns a range of characters from string starting at first
(zero-based) for length characters.
The special keyword end may be specified
for length to indicate that the remainder of the string is to be
extracted. This command is a short cut for:
string range string first [expr length-1]
- ctype class string
-
Determine if all characters in string are in of the specified
class. Returns 1 if they are all of class and 0 if
they are not or if the string is null. This command also provides another
method (besides format and scan) of converting between an ASCII
character and its numeric value. The following ctype commands are
available.
-
- ctype alnum string
-
Tests that all characters are alphabetic or numeric characters as defined by
the character set.
- ctype alpha string
-
Tests that all characters are alphabetic characters as defined by the
character set.
- ctype ascii string
-
Tests that all characters are an ASCII character (a non-negative number less
than 0200).
- ctype char number
-
Converts the numeric value, string, to an ASCII character. Number must
be in the range 0 through 255.
- ctype cntrl string
-
Tests that all characters are ``control characters'' as defined by the
character set.
- ctype digit string
-
Tests that all characters are valid decimal digits, i.e. 0 through 9.
- ctype graph string
-
Tests that all characters within are any character for which ctype print
is true, except for space characters.
- ctype lower string
-
Tests that all characters are lowercase letters as defined by the character
set.
- ctype ord character
-
Convert a character into its decimal numeric value. The string must be one
character long.
- ctype space string
-
Tests that all characters are either a space, horizontal-tab, carriage
return, newline, vertical-tab, or form-feed.
- ctype print string
-
Tests that all characters are a space or any character for which ctype
alnum or ctype punct is true or other ``printing character'' as
defined by the character set.
- ctype punct string
-
Tests that all characters are made up of any of the characters
other than the ones for which
alnum, cntrl, or space is true.
- ctype upper string
-
Tests that all characters are uppercase letters as defined by the character
set.
- ctype xdigit string
-
Tests that all characters are valid hexadecimal digits, that is 0
through 9, a through f or A through F.
- replicate string count
-
Returns string replicated count times.
- translit inrange outrange string
-
Translate characters in string matching characters in inrange
to the corresponding character in outrange. Inrange and
outrange may be list of characters or a range in the form `A-M'.
Example:
translit a-z A-Z foobar
returns
FOOBAR
Index
- NAME
-
- INTRODUCTION
-
- GENERAL COMMANDS
-
- UNIX ACCESS COMMANDS
-
- FILE I/O COMMANDS
-
- FILE SCANNING COMMANDS
-
- MATH COMMANDS
-
- LIST MANINIPULATION COMMANDS
-
- KEYED LISTS
-
- STRING AND CHARACTER MANIPULATION COMMANDS
-
This document was created by
man2html,
using the manual pages.
Time: 22:47:22 GMT, December 11, 2024